import random
from random import randint



print('------------------')
print("欢迎来到猜数字游戏")
print('------------------')
coin=5000
print("玩家拥有金币数量:{}".format(coin))
x=random.randint(1,10)
print("系统随机生成数字：")
number=int(input("从键盘输入数字="))


if x>number:
    print("小了")
    coin -= 500
    print("金币剩余:{}".format(coin))
    while x != number:
     number = int(input("从键盘输入数字="))
     coin-=500
     print("金币剩余:{}".format(coin))
     if x>number:
        print("小了")
     elif x<number:
        print("大了")
    else:
        print("恭喜猜中，本轮幸运数字:{}".format(x))
        coin += 500
        print("金币剩余:{}".format(coin))
elif x<number:
    print("大了")
    coin -= 500
    print("金币剩余:{}".format(coin))
    while x!=number:
     number = int(input("从键盘输入数字="))
     coin-=500
     print("金币剩余:{}".format(coin))
     if x>number:
        print("小了")
     elif x<number:
        print("大了")
    else:
        print("恭喜猜中，本轮幸运数字:{}".format(x))
        coin += 500
        print("金币剩余:{}".format(coin))
else :

    print("恭喜猜中，本轮幸运数字:{}".format(x))
    coin+=3000

    print("金币剩余:{}".format(coin))
    print("游戏结束")

    g = input(0, 1)
    print("是否继续下一轮游戏:{}".format(g))







